libxl: beautify json with YAJL2
authorM A Young <m.a.young@durham.ac.uk>
Thu, 11 Apr 2013 23:02:11 +0000 (00:02 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 12 Apr 2013 11:21:02 +0000 (12:21 +0100)
xl list -l should produce readable output when built with yajl2 so
it is compatible with the xendomains script.

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_json.h

index 14644591414ba4af2d92a3ae681f9628a3443d59..a4dd8fcaca91ba64ab4c6bf3792b67de09928ff7 100644 (file)
@@ -54,7 +54,11 @@ static inline yajl_handle libxl__yajl_alloc(const yajl_callbacks *callbacks,
 
 static inline yajl_gen libxl_yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
 {
-    return yajl_gen_alloc(allocFuncs);
+    yajl_gen g;
+    g = yajl_gen_alloc(allocFuncs);
+    if (g)
+        yajl_gen_config(g, yajl_gen_beautify, 1);
+    return g;
 }
 
 #else /* !HAVE_YAJL_V2 */